var express = require('express');
var router = express.Router();
const sql = require('../db/index');


// 登录接口
router.post('/login',async function(req,res,next){
  const {username,password} = req.body;
  const [result] = await sql.query('select * from base_user where username = ?and password = ?'
  ,[username,password]);
  res.send({
    status:200,
    message:"登录成功",
    data:result,
    token:Math.random().toString(36),
    timestamp:new Date().getTime()
  })
});
module.exports = router;